Popular Searches
Popular Course Categories
Popular Courses

ChromeDriver / EdgeDriver

ChromeDriver / EdgeDriver

Selenium Environment Setup

ChromeDriver and EdgeDriver

ChromeDriver and EdgeDriver are browser-specific WebDriver implementations used with Selenium to automate Google Chrome and Microsoft Edge. They act as the communication layer between Selenium WebDriver commands and the actual browser.

Selenium WebDriver provides a common API, while the browser-specific driver communicates those commands to the selected browser. Modern Selenium versions can use Selenium Manager to automatically discover and manage the required browser driver in many common environments, reducing the need for manual driver downloads and PATH configuration.


1. What is ChromeDriver?

ChromeDriver is the WebDriver implementation used to automate Google Chrome through Selenium. It receives commands from Selenium WebDriver and communicates with the Chrome browser to perform actions such as opening URLs, locating elements, clicking buttons, entering text, navigating between pages, and closing the browser.

The basic communication flow is:

Selenium Test Script
        |
        v
Selenium WebDriver API
        |
        v
ChromeDriver
        |
        v
Google Chrome
        |
        v
Web Application

ChromeDriver provides the browser-specific communication layer required to control Chrome through Selenium WebDriver.

2. What is EdgeDriver?

EdgeDriver is the WebDriver implementation used to automate Microsoft Edge. It allows Selenium WebDriver to create and control an Edge browser session on the local machine.

Modern Microsoft Edge is Chromium-based, and Selenium provides Edge-specific APIs and classes for controlling it.

Selenium Test Script
        |
        v
Selenium WebDriver API
        |
        v
EdgeDriver
        |
        v
Microsoft Edge
        |
        v
Web Application

3. ChromeDriver vs EdgeDriver

Feature ChromeDriver EdgeDriver
Browser Google Chrome Microsoft Edge
Driver ChromeDriver Microsoft Edge WebDriver / msedgedriver
Browser Engine Chromium Chromium
Python Object webdriver.Chrome() webdriver.Edge()
Python Options ChromeOptions EdgeOptions
Java Class ChromeDriver EdgeDriver
Common Use Chrome web automation Edge web automation
Headless Testing Supported Supported
Cross-Browser Testing Yes Yes

4. Why Do We Need ChromeDriver and EdgeDriver?

Selenium does not directly control the internal browser implementation. Instead, Selenium WebDriver communicates with a browser-specific driver.

The driver acts as an intermediary between the Selenium test and the browser.

Test Script
    |
    v
Selenium WebDriver
    |
    +------------------+
    |                  |
    v                  v
ChromeDriver       EdgeDriver
    |                  |
    v                  v
Chrome              Edge
    |                  |
    +--------+---------+
             |
             v
      Web Application

5. ChromeDriver Architecture

ChromeDriver provides the browser-specific communication required to control Chrome through Selenium WebDriver.

Python / Java / C# Test
          |
          v
   Selenium WebDriver
          |
          v
      ChromeDriver
          |
          v
         Chrome
          |
          v
    Web Application

Important Components

  • Test Script: Contains automation instructions.
  • Selenium WebDriver: Provides the programming API used by the test.
  • ChromeDriver: Communicates Selenium commands to Chrome.
  • Chrome: Executes browser actions.
  • Web Application: The application being tested.

6. EdgeDriver Architecture

Python / Java / C# Test
          |
          v
   Selenium WebDriver
          |
          v
       EdgeDriver
          |
          v
     Microsoft Edge
          |
          v
    Web Application

Modern Microsoft Edge is Chromium-based, and Selenium provides Edge-specific APIs and classes for controlling it.

7. Installing Selenium for Python

For Python automation, install the Selenium package using pip:

python -m pip install selenium

You can verify the installation with:

python -c "import selenium; print(selenium.__version__)"

Modern Selenium can invoke Selenium Manager when a driver is not otherwise provided, so a separate driver download is often unnecessary for common setups.

8. Basic ChromeDriver Program in Python

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.google.com")

print("Title:", driver.title)
print("URL:", driver.current_url)

driver.quit()

Explanation

  • webdriver.Chrome() creates a Chrome WebDriver session.
  • driver.get() opens the specified URL.
  • driver.title returns the page title.
  • driver.current_url returns the current URL.
  • driver.quit() closes the browser session and associated windows.

9. Basic EdgeDriver Program in Python

from selenium import webdriver

driver = webdriver.Edge()

driver.get("https://www.microsoft.com")

print("Title:", driver.title)
print("URL:", driver.current_url)

driver.quit()

The Python Selenium Edge WebDriver creates and controls an Edge browser session.

10. ChromeDriver Program Using a Function

from selenium import webdriver

def open_chrome():
    driver = webdriver.Chrome()
    try:
        driver.get("https://www.google.com")
        print("Browser:", driver.name)
        print("Title:", driver.title)
        print("URL:", driver.current_url)
    finally:
        driver.quit()

open_chrome()

11. EdgeDriver Program Using a Function

from selenium import webdriver

def open_edge():
    driver = webdriver.Edge()
    try:
        driver.get("https://www.microsoft.com")
        print("Browser:", driver.name)
        print("Title:", driver.title)
        print("URL:", driver.current_url)
    finally:
        driver.quit()

open_edge()

12. ChromeDriver in Java

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class ChromeDemo {
    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();

        try {
            driver.get("https://www.google.com");

            System.out.println("Title: " + driver.getTitle());
            System.out.println("URL: " + driver.getCurrentUrl());
        } finally {
            driver.quit();
        }
    }
}

13. EdgeDriver in Java

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;

public class EdgeDemo {
    public static void main(String[] args) {
        WebDriver driver = new EdgeDriver();

        try {
            driver.get("https://www.microsoft.com");

            System.out.println("Title: " + driver.getTitle());
            System.out.println("URL: " + driver.getCurrentUrl());
        } finally {
            driver.quit();
        }
    }
}

14. ChromeDriver Class in Selenium Java

The Selenium Java API provides the ChromeDriver class for creating a WebDriver implementation that controls Chrome. The Chrome driver can use default service configuration or an explicitly supplied service when special configuration is required.

WebDriver driver = new ChromeDriver();

15. EdgeDriver Class in Selenium Java

The Selenium Java API provides the EdgeDriver class for controlling Microsoft Edge on the local machine. It can be created with default configuration or with Edge-specific service and options objects.

WebDriver driver = new EdgeDriver();

16. ChromeDriver and Selenium Manager

In older Selenium workflows, developers commonly downloaded ChromeDriver manually, placed it on the system PATH, or specified its executable location in code.

Modern Selenium includes Selenium Manager, the official driver management component of Selenium. Selenium bindings can use it automatically when appropriate, allowing Selenium to discover and manage the required driver in many environments.

from selenium import webdriver

driver = webdriver.Chrome()

The simple code above can allow Selenium to handle driver management automatically when Selenium Manager can resolve the required environment.

17. EdgeDriver and Selenium Manager

EdgeDriver can also be managed through Selenium Manager in modern Selenium environments.

from selenium import webdriver

driver = webdriver.Edge()

This removes much of the traditional manual setup for common local environments.

18. Traditional Manual ChromeDriver Setup

A traditional Selenium setup may require the following workflow:

  1. Install Google Chrome.
  2. Check the Chrome browser version.
  3. Identify the compatible ChromeDriver version.
  4. Download the required driver.
  5. Extract the driver package.
  6. Place the executable in an appropriate location.
  7. Add the location to PATH or configure the driver explicitly.
  8. Create the Selenium WebDriver object.
  9. Start the browser session.

19. Traditional Manual EdgeDriver Setup

A traditional Edge automation setup follows a similar process:

  1. Install Microsoft Edge.
  2. Check the Edge browser version.
  3. Identify the corresponding Edge WebDriver.
  4. Download the driver.
  5. Extract the driver package.
  6. Configure PATH or an explicit driver location.
  7. Create an Edge WebDriver instance.
  8. Start the Edge browser session.

When manually managing EdgeDriver, the Edge browser and EdgeDriver major versions should be compatible.

20. Chrome Browser and ChromeDriver Compatibility

Browser-driver compatibility is an important consideration when using explicit driver management. A mismatch can prevent Selenium from creating a browser session.

Component Example Purpose
Browser Google Chrome Browser being automated
Driver ChromeDriver Communicates with Chrome
Selenium Selenium 4.x Automation API
Operating System Windows/Linux/macOS Execution environment

21. Edge Browser and EdgeDriver Compatibility

For Chromium-based Microsoft Edge, the major version of EdgeDriver should match the major version of the Edge browser when using an explicitly managed driver.

Microsoft Edge
      |
      | Major Version
      v
EdgeDriver
      |
      v
Selenium WebDriver
      |
      v
Automation Test

22. ChromeDriver Service in Python

If a project requires explicit control over the driver executable, Selenium provides the Service object.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service("/path/to/chromedriver")

driver = webdriver.Chrome(service=service)

driver.get("https://www.google.com")
print(driver.title)

driver.quit()

The path must point to the actual driver executable available in the environment.

23. EdgeDriver Service in Python

Edge also provides a Service object that can be used when explicit driver-service configuration is required.

from selenium import webdriver
from selenium.webdriver.edge.service import Service

service = Service("/path/to/msedgedriver")

driver = webdriver.Edge(service=service)

driver.get("https://www.microsoft.com")
print(driver.title)

driver.quit()

24. Chrome Options

ChromeOptions allows automation scripts to configure how Chrome starts and behaves.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--start-maximized")

driver = webdriver.Chrome(options=options)

driver.get("https://www.google.com")
print(driver.title)

driver.quit()

Common Chrome Options

Option Purpose
--start-maximized Starts Chrome maximized.
--headless=new Runs Chrome without the normal visible browser window.
--incognito Starts Chrome in Incognito mode.
--disable-notifications Disables browser notifications where supported.
--user-data-dir=... Specifies a Chrome user-data directory.

25. Edge Options

EdgeOptions allows Selenium to configure Microsoft Edge before creating the browser session.

from selenium import webdriver
from selenium.webdriver.edge.options import Options

options = Options()
options.add_argument("--start-maximized")

driver = webdriver.Edge(options=options)

driver.get("https://www.microsoft.com")
print(driver.title)

driver.quit()

Common Edge Options

Option Purpose
--start-maximized Starts Edge maximized.
--headless=new Runs Edge without the normal visible browser window.
--incognito Starts Edge in private browsing mode where supported.
--disable-notifications Disables browser notifications where supported.
--user-data-dir=... Specifies a browser user-data directory.

26. Chrome Headless Automation

Headless Chrome runs without displaying the normal graphical browser interface. It is useful for environments such as CI/CD servers where a visible desktop browser may not be available.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)

driver.get("https://www.google.com")
print(driver.title)

driver.quit()

27. Edge Headless Automation

from selenium import webdriver
from selenium.webdriver.edge.options import Options

options = Options()
options.add_argument("--headless=new")

driver = webdriver.Edge(options=options)

driver.get("https://www.microsoft.com")
print(driver.title)

driver.quit()

28. ChromeDriver Browser Navigation

ChromeDriver can be used to automate common browser navigation operations through WebDriver.

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.google.com")
driver.get("https://www.selenium.dev")

driver.back()
driver.forward()
driver.refresh()

driver.quit()

29. EdgeDriver Browser Navigation

from selenium import webdriver

driver = webdriver.Edge()

driver.get("https://www.microsoft.com")
driver.get("https://www.selenium.dev")

driver.back()
driver.forward()
driver.refresh()

driver.quit()

30. Finding Elements with ChromeDriver

Once ChromeDriver creates a browser session, Selenium WebDriver can locate and interact with elements on the page.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("https://www.google.com")

search_box = driver.find_element(By.NAME, "q")
search_box.send_keys("Selenium WebDriver")
search_box.submit()

driver.quit()

31. Finding Elements with EdgeDriver

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()

driver.get("https://www.google.com")

search_box = driver.find_element(By.NAME, "q")
search_box.send_keys("Selenium EdgeDriver")
search_box.submit()

driver.quit()

32. ChromeDriver and EdgeDriver with WebElements

Operation Selenium Method
Find element find_element()
Enter text send_keys()
Click click()
Read text text
Read attribute get_attribute()
Clear field clear()
Submit form submit()

33. ChromeDriver and EdgeDriver Session Lifecycle

Create WebDriver
       |
       v
Start Browser Session
       |
       v
Open Web Application
       |
       v
Locate Elements
       |
       v
Perform Actions
       |
       v
Validate Results
       |
       v
Take Screenshot / Generate Report
       |
       v
Quit Browser Session

34. Using a Driver Variable

A common Selenium pattern is to store the browser driver in a WebDriver variable.

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.google.com")

print(driver.title)

driver.quit()

The same pattern can be changed to Edge:

from selenium import webdriver

driver = webdriver.Edge()

driver.get("https://www.google.com")

print(driver.title)

driver.quit()

35. Switching Between Chrome and Edge

A test framework can use configuration to select the browser dynamically instead of changing the test code manually.

from selenium import webdriver

browser = "chrome"

if browser == "chrome":
    driver = webdriver.Chrome()
elif browser == "edge":
    driver = webdriver.Edge()
else:
    raise ValueError("Unsupported browser")

driver.get("https://www.google.com")
print(driver.title)

driver.quit()

36. Browser Factory Concept

A Driver Factory centralizes browser creation. This prevents every test case from containing separate driver initialization logic.

from selenium import webdriver

def create_driver(browser):
    if browser == "chrome":
        return webdriver.Chrome()
    elif browser == "edge":
        return webdriver.Edge()
    else:
        raise ValueError("Unsupported browser")

driver = create_driver("chrome")

driver.get("https://www.google.com")
print(driver.title)

driver.quit()

37. Multi-Browser Automation Architecture

             Test Case
                 |
                 v
           Driver Factory
                 |
        +--------+--------+
        |                 |
        v                 v
   ChromeDriver       EdgeDriver
        |                 |
        v                 v
      Chrome             Edge
        |                 |
        +--------+--------+
                 |
                 v
          Web Application

38. Cross-Browser Testing

Cross-browser testing verifies that a web application behaves correctly across different supported browsers.

Browser Driver Selenium Object
Google Chrome ChromeDriver webdriver.Chrome()
Microsoft Edge EdgeDriver webdriver.Edge()
Mozilla Firefox GeckoDriver webdriver.Firefox()
Safari SafariDriver webdriver.Safari()

39. Chrome and Edge Cross-Browser Test Example

from selenium import webdriver

browsers = ["chrome", "edge"]

for browser in browsers:
    if browser == "chrome":
        driver = webdriver.Chrome()
    else:
        driver = webdriver.Edge()

    try:
        driver.get("https://www.google.com")
        print(browser, ":", driver.title)
    finally:
        driver.quit()

40. ChromeDriver and EdgeDriver in CI/CD

Browser automation is frequently executed in CI/CD pipelines. The automation environment must have a compatible browser and a working driver-management strategy.

Developer
   |
   v
Git Repository
   |
   v
CI/CD Pipeline
   |
   v
Install Selenium
   |
   v
Configure Browser
   |
   v
Selenium Manager / Driver Service
   |
   v
Chrome / Edge
   |
   v
Execute Tests
   |
   v
Reports

41. ChromeDriver and EdgeDriver in Selenium Grid

For distributed automation, Selenium Grid can route tests to different browser environments.

                 Test Suite
                     |
                     v
                Selenium Grid
                /           \
               /             \
              v               v
     Chrome Environment   Edge Environment
              |               |
        ChromeDriver      EdgeDriver
              |               |
           Chrome             Edge

This architecture allows the same automation suite to be executed against different browser environments.

42. ChromeDriver and EdgeDriver with Page Object Model

In a Page Object Model (POM) framework, browser creation should generally be kept separate from page-specific actions.

Test Class
    |
    v
Driver Factory
    |
    +------> ChromeDriver
    |
    +------> EdgeDriver
    |
    v
WebDriver Session
    |
    v
Page Objects
    |
    v
Web Application

43. ChromeDriver and EdgeDriver with TestNG

A TestNG-based Java project can initialize a browser before each test and close it after the test.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class ChromeTest {

    private WebDriver driver;

    @BeforeMethod
    public void setUp() {
        driver = new ChromeDriver();
    }

    @Test
    public void openWebsite() {
        driver.get("https://www.google.com");
        System.out.println(driver.getTitle());
    }

    @AfterMethod
    public void tearDown() {
        if (driver != null) {
            driver.quit();
        }
    }
}

44. EdgeDriver with TestNG

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class EdgeTest {

    private WebDriver driver;

    @BeforeMethod
    public void setUp() {
        driver = new EdgeDriver();
    }

    @Test
    public void openWebsite() {
        driver.get("https://www.microsoft.com");
        System.out.println(driver.getTitle());
    }

    @AfterMethod
    public void tearDown() {
        if (driver != null) {
            driver.quit();
        }
    }
}

45. ChromeDriver and EdgeDriver with Browser Configuration

A configuration file can determine which browser should be launched.

browser=chrome
headless=false
environment=test

The framework can then read the browser value and create the appropriate WebDriver.

Configuration
      |
      v
Driver Factory
      |
      +---- chrome ----> ChromeDriver
      |
      +---- edge ------> EdgeDriver
      |
      v
WebDriver
      |
      v
Browser Session

46. Common ChromeDriver Errors

Error/Symptom Possible Cause Recommended Check
Driver not found Driver unavailable or configuration problem Check Selenium Manager or explicit driver configuration.
SessionNotCreatedException Browser/driver/environment incompatibility Check browser, Selenium and driver configuration.
Browser does not start Installation or environment problem Verify browser installation and permissions.
Invalid driver path Incorrect Service path Verify the executable path.
Permission denied Execution permissions or security policy Check executable permissions and OS policies.
Works locally but not in CI Different environment Compare browser, OS, permissions and configuration.

47. Common EdgeDriver Errors

Error/Symptom Possible Cause Recommended Check
Driver not found Driver configuration problem Check Selenium Manager or driver path.
Session cannot be created Browser/driver mismatch Check Edge and EdgeDriver versions.
Edge does not start Installation/environment issue Verify Edge installation.
Invalid driver path Incorrect Service configuration Check msedgedriver location.
Permission denied OS security or execution permissions Check executable permissions.

48. SessionNotCreatedException

SessionNotCreatedException can occur when Selenium cannot create a valid browser session because the browser, driver, Selenium configuration, or execution environment is incompatible or incorrectly configured.

Troubleshooting Steps

  1. Check the installed browser version.
  2. Check the Selenium version.
  3. If using a manually managed driver, check its compatibility.
  4. Check whether an old driver is being selected through PATH.
  5. Try Selenium Manager with a current Selenium release.
  6. Check the operating system and architecture.
  7. Check browser and driver permissions.
  8. Run a minimal WebDriver program.

49. Driver Path Problems

When manually configuring a driver, an incorrect path can prevent the browser session from starting.

Incorrect example:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service("wrong/path/chromedriver")
driver = webdriver.Chrome(service=service)

Correct concept:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service("/actual/path/to/chromedriver")
driver = webdriver.Chrome(service=service)

50. ChromeDriver Debugging Program

from selenium import webdriver

driver = webdriver.Chrome()

try:
    print("Starting Chrome...")
    driver.get("https://www.google.com")
    print("Browser started")
    print("URL:", driver.current_url)
    print("Title:", driver.title)
finally:
    driver.quit()
    print("Browser closed")

51. EdgeDriver Debugging Program

from selenium import webdriver

driver = webdriver.Edge()

try:
    print("Starting Edge...")
    driver.get("https://www.microsoft.com")
    print("Browser started")
    print("URL:", driver.current_url)
    print("Title:", driver.title)
finally:
    driver.quit()
    print("Browser closed")

52. ChromeDriver Logging

Driver logging can be useful when diagnosing browser startup, driver communication, CI failures, or configuration problems. Selenium and browser-specific driver services provide logging configuration options where supported.

53. ChromeDriver vs EdgeDriver: Service and Options

Area Chrome Edge
WebDriver Class ChromeDriver EdgeDriver
Service Class ChromeDriver Service EdgeDriver Service
Options Class ChromeOptions EdgeOptions
Python Constructor webdriver.Chrome() webdriver.Edge()
Headless Argument --headless=new --headless=new
Browser Engine Chromium Chromium

54. Practical Project: ChromeDriver and EdgeDriver Verification

In this practical project, we create a small Selenium application that allows us to test both Chrome and Edge.

Project Structure

browser-driver-project/
|
+-- test_browser_drivers.py
+-- requirements.txt
+-- README.md

requirements.txt

selenium

test_browser_drivers.py

from selenium import webdriver

def run_test(browser):
    if browser == "chrome":
        driver = webdriver.Chrome()
    elif browser == "edge":
        driver = webdriver.Edge()
    else:
        raise ValueError("Unsupported browser")

    try:
        driver.get("https://www.google.com")

        print("Browser:", browser)
        print("Title:", driver.title)
        print("URL:", driver.current_url)
    finally:
        driver.quit()

run_test("chrome")
run_test("edge")

Project Flow

Create Project
      |
      v
Install Selenium
      |
      v
Select Browser
      |
      +----------+
      |          |
      v          v
   Chrome      Edge
      |          |
      v          v
ChromeDriver  EdgeDriver
      |          |
      +-----+----+
            |
            v
      Web Application
            |
            v
       Validate Test
            |
            v
        Quit Browser

55. Real-Time Framework Architecture

In a professional automation framework, ChromeDriver and EdgeDriver should normally be created through a centralized driver-management layer instead of being repeatedly initialized inside every test case.

Test Case
    |
    v
Base Test
    |
    v
Driver Factory
    |
    +--------------------+
    |                    |
    v                    v
Chrome Configuration   Edge Configuration
    |                    |
    v                    v
ChromeOptions          EdgeOptions
    |                    |
    v                    v
ChromeDriver           EdgeDriver
    |                    |
    +---------+----------+
              |
              v
       WebDriver Session
              |
              v
         Page Objects
              |
              v
        Test Execution
              |
              v
           Reporting

56. Best Practices for ChromeDriver and EdgeDriver

  • Use a supported Selenium version.
  • Prefer Selenium Manager for standard modern setups.
  • Use explicit Service configuration when your environment requires it.
  • Avoid unnecessary hard-coded driver paths.
  • Centralize WebDriver creation in a Driver Factory.
  • Keep browser configuration separate from test logic.
  • Use browser-specific Options when required.
  • Use headless execution where appropriate for CI environments.
  • Keep local and CI environments consistent.
  • Always terminate browser sessions using quit().
  • Use trusted sources when manually obtaining browser-driver binaries.
  • Document any non-standard browser-driver configuration.

57. Common Mistakes

Mistake Problem Better Practice
Using an outdated driver Browser session may fail Use appropriate driver management.
Incorrect driver path Driver cannot start Verify the Service path.
Ignoring browser versions Compatibility problems Check browser/driver compatibility when manually managed.
Duplicate driver creation Unnecessary sessions Centralize driver creation.
Sharing one driver incorrectly Test interference Use appropriate isolated sessions.
Forgetting quit() Browser processes remain active Use try/finally or framework teardown.
Different local and CI configuration Tests work locally but fail in CI Standardize environment configuration.

58. ChromeDriver and EdgeDriver in Parallel Testing

Parallel testing can execute multiple browser sessions at the same time. For example, one test can run in Chrome while another runs in Edge.

Parallel Test Execution
        |
        +----------------+
        |                |
        v                v
     Chrome             Edge
        |                |
   ChromeDriver       EdgeDriver
        |                |
    Session 1         Session 2

Each independent test should receive an appropriate WebDriver session rather than incorrectly sharing a single browser instance between unrelated parallel tests.

59. Browser Selection Through Command-Line Configuration

A framework can allow the browser to be selected through configuration.

python test_browser.py --browser chrome

or:

python test_browser.py --browser edge

The test framework can then read the browser argument and create the appropriate driver.

60. ChromeDriver and EdgeDriver Security Considerations

  • Use trusted sources for manually obtained driver binaries.
  • Do not execute unknown or unverified driver executables.
  • Keep Selenium and related dependencies appropriately maintained.
  • Do not place passwords or API keys directly in browser configuration files.
  • Secure CI/CD environments.
  • Review execution permissions for browser-driver processes.
  • Avoid unnecessarily exposing remote browser or debugging interfaces.
  • Use controlled test environments for automation.

61. ChromeDriver and EdgeDriver Quick Revision

Question Answer
What is ChromeDriver? WebDriver implementation used to automate Google Chrome.
What is EdgeDriver? WebDriver implementation used to automate Microsoft Edge.
What does ChromeDriver communicate with? Google Chrome.
What does EdgeDriver communicate with? Microsoft Edge.
Python Chrome object webdriver.Chrome()
Python Edge object webdriver.Edge()
Java Chrome class ChromeDriver
Java Edge class EdgeDriver
Chrome Options ChromeOptions
Edge Options EdgeOptions
Automated driver management Selenium Manager
Explicit driver configuration Service object
Browser startup configuration Options object
Centralized browser creation Driver Factory

62. ChromeDriver and EdgeDriver Interview Questions

Q1. What is ChromeDriver?

ChromeDriver is the WebDriver implementation that enables Selenium to automate Google Chrome.

Q2. What is EdgeDriver?

EdgeDriver is the WebDriver implementation that enables Selenium to automate Microsoft Edge.

Q3. Why do we need a browser driver?

The browser driver acts as the browser-specific communication component between Selenium WebDriver and the browser.

Q4. What is the difference between ChromeDriver and EdgeDriver?

ChromeDriver controls Chrome, while EdgeDriver controls Microsoft Edge.

Q5. How do you start Chrome using Selenium Python?

from selenium import webdriver

driver = webdriver.Chrome()

Q6. How do you start Edge using Selenium Python?

from selenium import webdriver

driver = webdriver.Edge()

Q7. What is Selenium Manager?

Selenium Manager is Selenium's automated driver and browser management component. Selenium bindings can use it automatically when appropriate.

Q8. Do we always need to manually download ChromeDriver?

No. Modern Selenium can use Selenium Manager to automate driver management in many common environments.

Q9. What is ChromeOptions?

ChromeOptions is used to configure Chrome before creating a WebDriver session.

Q10. What is EdgeOptions?

EdgeOptions is used to configure Microsoft Edge before creating an Edge WebDriver session.

Q11. What is the Service class?

The Service object is used when explicit browser-driver service configuration is required, such as specifying a driver executable or service-related settings.

Q12. What causes SessionNotCreatedException?

It can result from an incompatible or incorrectly configured browser, driver, Selenium environment, or browser startup configuration.

Q13. How can Chrome and Edge be tested using the same test suite?

Use a browser configuration or Driver Factory that creates either ChromeDriver or EdgeDriver based on the selected browser.

Q14. Can ChromeDriver and EdgeDriver run in headless mode?

Yes. Chromium-based Chrome and Edge can be configured with headless browser arguments.

Q15. Why should WebDriver creation be centralized?

Centralized creation reduces duplicate configuration and makes multi-browser testing and framework maintenance easier.

63. Recommended Selenium Learning Path

  1. Introduction to Software Testing
  2. Introduction to Selenium
  3. Selenium Installation and Setup
  4. Browser Drivers
  5. ChromeDriver and EdgeDriver
  6. Selenium WebDriver
  7. Locators
  8. WebElements
  9. Browser Commands
  10. Waits and Synchronization
  11. Alerts and Popups
  12. Frames and iFrames
  13. Windows and Tabs
  14. Dropdowns
  15. Mouse and Keyboard Actions
  16. JavaScript Executor
  17. TestNG
  18. Page Object Model
  19. Data-Driven Testing
  20. Automation Framework Development
  21. Selenium Grid
  22. Cross-Browser Testing
  23. Git and GitHub
  24. CI/CD Integration
  25. Real-Time Automation Project
  26. Interview Preparation

64. Selenium Training Resource

For structured Selenium automation testing training, practical projects, Selenium WebDriver concepts, automation frameworks, cross-browser testing, and interview preparation, you can explore the JustAcademy Selenium Training Course.

JustAcademy Selenium Training Course

You can also register for a Selenium course demo through the following link:

JustAcademy Selenium Course Demo Registration

65. Final Summary

ChromeDriver and EdgeDriver are important components of Selenium browser automation. ChromeDriver is used for Google Chrome, while EdgeDriver is used for Microsoft Edge.

The basic architecture is:

Selenium Test
     |
     v
Selenium WebDriver
     |
     +------------------+
     |                  |
     v                  v
ChromeDriver        EdgeDriver
     |                  |
     v                  v
Chrome               Edge
     |                  |
     +--------+---------+
              |
              v
       Web Application

Modern Selenium includes Selenium Manager, which can automate driver management in many environments. When explicit control is required, Selenium also provides browser-specific Service and Options mechanisms.

66. Learning Outcomes

  • Understand the purpose of browser drivers in Selenium.
  • Understand ChromeDriver and its relationship with Chrome.
  • Understand EdgeDriver and its relationship with Microsoft Edge.
  • Create Chrome automation using Python.
  • Create Edge automation using Python.
  • Create Chrome automation using Java.
  • Create Edge automation using Java.
  • Understand Selenium Manager.
  • Understand traditional manual driver management.
  • Understand browser-driver compatibility.
  • Configure ChromeDriver and EdgeDriver using Service objects.
  • Configure Chrome and Edge using Options objects.
  • Run Chrome and Edge in headless mode.
  • Build multi-browser automation.
  • Use a Driver Factory architecture.
  • Understand ChromeDriver and EdgeDriver in CI/CD.
  • Understand their role in Selenium Grid.
  • Use Chrome and Edge for cross-browser testing.
  • Troubleshoot common driver errors.
  • Prepare for ChromeDriver and EdgeDriver interview questions.

Complete ChromeDriver and EdgeDriver Workflow

Choose Browser
      |
      v
Install Chrome / Edge
      |
      v
Install Selenium
      |
      v
Choose Driver Management
      |
      +---------------------------+
      |                           |
      v                           v
Selenium Manager          Manual Service Setup
      |                           |
      v                           v
Resolve Driver             Configure Driver
      |                           |
      +-------------+-------------+
                    |
                    v
             Browser Options
                    |
                    v
               WebDriver
                    |
                    v
             Browser Session
                    |
                    v
          Open Web Application
                    |
                    v
             Locate Elements
                    |
                    v
             Perform Actions
                    |
                    v
             Validate Results
                    |
                    v
          Reports / Screenshots
                    |
                    v
                 quit()
                    |
                    v
              Test Complete
Previous Next
whatsapp